package com.libra.assemble.xutil.collection.compare;

import com.libra.assemble.xutil.excel.form.CellAttributeForm;

import java.util.Comparator;

/**
 * 用于对Excel列的List进行排序.
 *
 * @author Libra
 */
public class CellCompare implements Comparator<CellAttributeForm> {

    @Override
    public int compare(CellAttributeForm entity1, CellAttributeForm entity2) {

        int flag = entity1.getOrder().compareTo(entity2.getOrder());

        if (flag == 0) {
            return entity1.getKey().compareTo(entity2.getKey());
        } else {
            return flag;
        }
    }

}
